package com.zzy.redis.test;

import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class RedisJava {
    public static void main(String[] args) {
        //连接本地的 Redis 服务
        String url = "192.168.125.130";//localhost
        //Jedis jedis = new Jedis(url,6379);// http://192.168.125.130/
        GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
        JedisPool jedisPool = new JedisPool(poolConfig,url, 6379, 100000);
        Jedis jedis = jedisPool.getResource();
        System.out.println("连接成功");
        //查看服务是否运行
        System.out.println("服务正在运行: "+jedis.ping());
    }
}
